package xyz.xuminghai.javafx_learn.scene.transform;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.transform.Scale;
import javafx.stage.Stage;

/**
 * 2023/7/6 4:02 星期四<br/>
 * 缩放
 *
 * @author xuMingHai
 */
public class ScaleApp extends Application {

    private final BorderPane root = new BorderPane();

    public static void main(String[] args) {
        Application.launch(args);
    }

    @Override
    public void init() {
        Rectangle rectangle = new Rectangle(100.0, 100.0, Color.RED);
        Scale scale = new Scale(0.5, 0.5);
        rectangle.getTransforms().add(scale);

        root.setCenter(rectangle);
    }

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle(getClass().getSimpleName());
        Scene scene = new Scene(root, 800, 600);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}
